package com.water.dmdb.service;

import java.io.Serializable;
import java.lang.reflect.Field;

public class De implements Serializable {

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args) throws ClassNotFoundException {
        ClassLoader loader = De.class.getClassLoader();
        Class<?> aClass = loader.loadClass("com.water.dmdb.service.De");
        try {
           De de = (De) aClass.newInstance();
            System.out.println();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

//        extracted();
    }


    private static void extracted() {
        try {
            Class<?> aClass = Class.forName("com.water.dmdb.service.De");
            ClassLoader classLoader = aClass.getClassLoader();
            Field[] declaredFields = aClass.getDeclaredFields();
            for (int i = 0; i < declaredFields.length; i++) {
                Class<?> type = declaredFields[i].getType();

                Object o = type.newInstance();
                declaredFields[i].set(type, o);
            }
        } catch (ClassNotFoundException e) {
//         e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}
